import request from '@/utils/request'
import defaultSettings from '@/settings'

export function fetchList(query) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/list',
    method: 'post',
    data: query
  })
}

export function restPassword(accountId) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/restPassword?accountId=' + accountId,
    method: 'get'
  })
}
export function modifyAccountAvatar(avatar) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/modifyAvatar',
    method: 'post',
    data: avatar
  })
}

export function modifyPassword(password, newPassword) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/modifyPassword?password=' + password + '&newPassword=' + newPassword,
    method: 'get'
  })
}

export function save(data) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/save',
    method: 'post',
    data: data
  })
}
/**
 * 修改个人信息
 * @param {*} data 
 */
export function saveInfo(data) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/saveInfo',
    method: 'post',
    data: data
  })
}
export function updateUserStatusById(userId, status) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/updateUserStatusById?userId=' + userId + '&status=' + status,
    method: 'get'
  })
}

export function removeByIds(ids) {
  return request({
    url: defaultSettings.serviceUrl.moon_fast + '/sysUser/removeByIds?ids=' + ids,
    method: 'get'
  })
}
